<?php
session_start();

if (empty($_SESSION['id'])) {

    header("Location: ../../index.php");
}
require '../../lib/nusoap.php';

$wsdl = "http://localhost/sicoba/Servidor/Clientes.php?wsdl";
//$wsdl = "http://wouwou.xtrweb.com/sicoba/Servidor/Clientes.php?wsdl";
$cliente = new nusoap_client($wsdl, 'wsdl');
?>
<!DOCTYPE html>
<html>
    <head>
    <head lang="es">
        <title>Agua y Saneamiento de Amecameca</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width = device-width, initial-scale=1, maximum-scale=1"/>
        <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">        
        <link rel="stylesheet" href="../../css/flexslider.css">
        <link rel="stylesheet" href="../../css/estiloSicoba.css">
        <link rel="stylesheet" href="../../css/tab.css">
        <link rel="stylesheet" href="../../Js/jqueryUi/css/ui-lightness/jquery-ui-1.9.2.custom.css">
        <script src="../../js/jquery1_8_3.js"></script>
        <script src="../../js/jqueryUi/jquery-ui-1.9.2.custom.min.js"></script>
        <script src="../../js/jquery.flexslider.js"></script>
        <script src="../../js/Controladores/Principal_Capturista_Js.js"></script>
    </head>
</head>
<body>
    <div id="principal">
        <header>                
            <a href="#">    
                <img alt="asaLogo" src="../../img/asaGrises.png">
            </a>
            <div id="menu">
                <div>
                    <h1 style="background: url(../../img/bandera2.png)">Agua y Saneamiento de Amecameca</h1>
                </div>
                <nav class="nav">
                    <ul>
                        <li class="veinticinco"><a href="#">Usuarios</a></li>
                        <li class="veinticinco"><a href="#">Cuotas</a></li>
                        <li class="veinticinco"><a href="#">Descuentos</a></li>
                        <li class="veinticinco"><a href="#" id="Nav_Salir">Salir</a></li>
                    </ul>
                </nav>
            </div>
        </header>
    </div>
    <section>

        <div id="Div_contenedor" style="display: none">
            <div id="Div_principal" >
                <div id="Div_pbuscar" >
                    <center>
                        <br><br>
                        <table style="background-color: #D8E3FF; padding: 10px 20px;">
                            <tr>
                                <td>
                                    <select name="Slt_Buscar" id="Slt_Buscar">
                                        <option value="nocuenta">N° Cuenta</option>
                                        <option value="nombre">Nombre</option>
                                        <option value="apellido">Apellido</option>
                                        <option value="rsocial">Razon Social</option>
                                    </select>
                                </td>
                                <td rowspan="2">
                                    <!--<input type="button" name="Btn_Buscar" id="btnBuscar" value="     >     "  
                                           class="boton letrasI" >-->
                                    <img alt="Buscar" id="Btn_Buscar" src="../../img/lupa2.png"
                                         class="botonLupa">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" name="Inp_Buscar" id="Inp_Buscar">
                                </td>
                            </tr>                        
                        </table>
                    </center>
                </div>
                <div id="Div_presultados">
                    <center>
                        <br>                        
                        <?php
                        $buscador = array('campo' => 'nombre', 'valor' => '%', 'limite' => 'si');
                        $jsonbuscador = json_encode($buscador);
                        $datos = array('jsonbuscador' => $jsonbuscador);
                        $resp = $cliente->call('buscar', $datos);

                        $arregloDeArreglos = json_decode($resp);
                        $numFilas = count($arregloDeArreglos);
                        $tabla = ' <center>
                        <br><table style="max-width:450px;min-width: 200px;">
                            <tr>
                                <td style="text-align: center; width: 100px;" >No de Cuenta</td>
                                <td style="text-align: center;width: 250px;" >Nombre</td>
                            </tr>';
                        if ($numFilas > 0) {
                            for ($index = 0; $index < $numFilas; $index++) {

                                $tabla = $tabla . '<tr class="ren" id="' . $arregloDeArreglos[$index]->{'id'} . '">
                                <td style="text-align: left; width: 100px;" >' . $arregloDeArreglos[$index]->{'nocuenta'} . '</td>
                                    <td style="text-align: left; width: 100px;" >' . $arregloDeArreglos[$index]->{'nombre'} . '</td>
                            </tr>';
                            }
                        } else {
                            $tabla = $tabla . '<tr><td colspan="2">Sin Resultados</td></tr>';
                        }
                        $tabla = $tabla . '</table></center>';
                        echo $tabla;
                        ?>
                        </div>

                        </div>
                        <div id="Div_detalle">
                            <div id="Div_pdetalle">
                                <br><br><br><br>
                                <form name="Frm_Usuarios" id="Frm_Usuarios">
                                    <div class="tabs">
                                        <div class="tabs">
                                            <div class="tab">
                                                <input type="radio" id="tab-1" name="tab-group-1" checked>
                                                <label for="tab-1">Personales</label>
                                                <div class="content"> 
                                                    <br><br>
                                                    <table style="text-align: left">
                                                        <tr>
                                                            <td colspan="2">
                                                                <input type="hidden" value="" name="Inp_IdUsuario" id="Inp_IdUsuario">
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>NoCuenta</td> 
                                                            <td>
                                                                <input type="text" name="Inp_NoCta" id="Inp_NoCta" class="input">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>RFC</td> 
                                                            <td>
                                                                <input type="text" name="Inp_RFC" id="Inp_RFC" class="input">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Tipo de Persona</td> 
                                                            <td>
                                                                <select type="text" name="Inp_TPersona" id="Inp_TPersona" class="input selec">
                                                                    <option value="fisica">Fisica</option>
                                                                    <option value="moral">Moral</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table id="fisica">
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Nombre</td>
                                                            <td>
                                                                <input type="text" name="Inp_Nombre" id="Inp_Nombre" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr class=""><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Apellido Paterno</td>
                                                            <td>
                                                                <input type="text" name="Inp_Apaterno" id="Inp_Apaterno" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr class=""><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Apellido Materno</td>
                                                            <td>
                                                                <input type="text" name="Inp_Amaterno" id="Inp_Amaterno" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr class=""><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Sexo</td>
                                                            <td>
                                                                <select type="text" name="Inp_Sexo" id="Inp_Sexo" class="input selec">
                                                                    <option value="M">Masculino</option>
                                                                    <option value="F">Femenino</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                        <tr class=""><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Fecha de Nacimiento</td>
                                                            <td>
                                                                <input type="text" name="Inp_Fecha" id="Inp_Fecha" class="input letrasI inputB">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                    </table>
                                                    <table id="moral">
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr class="">
                                                            <td>Razon Social</td>
                                                            <td>
                                                                <input type="text" name="Inp_Rsocial" id="Inp_Rsocial" class="input letrasI"
                                                                       maxlength="10">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                    </table>                                        
                                                </div>
                                            </div>
                                            <div class="tab">
                                                <input type="radio" id="tab-2" name="tab-group-1" >
                                                <label for="tab-2">Cuenta</label>
                                                <div class="content"> 
                                                    <br><br>
                                                    <table style="text-align: left">                                            
                                                        <tr>
                                                            <td>Calle</td> 
                                                            <td>
                                                                <input type="text" name="Inp_Calle" id="Inp_Calle" class="input">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Numero</td>
                                                            <td>
                                                                <input type="text" name="Inp_Numero" id="Inp_Numero" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Colonia</td>
                                                            <td>
                                                                <input type="text" name="Inp_Colonia" id="Inp_Colonia" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>CP</td>
                                                            <td>
                                                                <input type="text" name="Inp_CP" id="Inp_CP" class="input letrasI">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Estado</td>
                                                            <td>
                                                                <select type="text" name="Inp_Estado" id="Inp_Estado" class="input letrasI">
                                                                    <option value="Aguascalientes">Aguascalientes</option>
                                                                    <option value="Baja California Norte">Baja California Norte</option>
                                                                    <option value="Baja California Sur">Baja California Sur</option>
                                                                    <option value="Campeche">Campeche</option>
                                                                    <option value="Chiapas">Chiapas</option>
                                                                    <option value="Chihuahua">Chihuahua</option>
                                                                    <option value="Coahuila">Coahuila</option>
                                                                    <option value="Colima">Colima</option>
                                                                    <option value="Distrito Federal">Distrito Federal</option>
                                                                    <option value="Durango">Durango</option>
                                                                    <option value="Guanajuato">Guanajuato</option>
                                                                    <option value="Guerrero">Guerrero</option>
                                                                    <option value="Hidalgo">Hidalgo</option>
                                                                    <option value="Jalisco">Jalisco</option>
                                                                    <option value="México">México</option>
                                                                    <option value="Michoacán">Michoacán</option>
                                                                    <option value="Morelos">Morelos</option>
                                                                    <option value="Nayarit">Nayarit</option>
                                                                    <option value="Nuevo León">Nuevo León</option>
                                                                    <option value="Oaxaca">Oaxaca</option>
                                                                    <option value="Puebla">Puebla</option>
                                                                    <option value="Querétaro">Querétaro</option>
                                                                    <option value="Quintana Roo">Quintana Roo</option>
                                                                    <option value="San Luis Potosi">San Luis Potosí</option>
                                                                    <option value="Sinaloa">Sinaloa</option>
                                                                    <option value="Sonora">Sonora</option>
                                                                    <option value="Tabasco">Tabasco</option>
                                                                    <option value="Tamaulipas">Tamaulipas</option>
                                                                    <option value="Tlaxcala">Tlaxcala</option>
                                                                    <option value="Veracruz">Veracruz</option>
                                                                    <option value="Yucatan">Yucatán</option>
                                                                    <option value="Zacatecas">Zacatecas</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Delegacion/Munucipio</td>
                                                            <td>
                                                                <input type="text" name="Inp_Del" id="Inp_Del" class="input letrasI inputB">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Telefono</td>
                                                            <td>
                                                                <input type="text" name="Inp_Telefono" id="Inp_Telefono" class="input letrasI"
                                                                       maxlength="10">
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="2">&nbsp;</td></tr>
                                                        <tr>
                                                            <td>Tipo de Toma</td>
                                                            <td>
                                                                <select type="text" name="Inp_Tipo" id="Inp_Tipo" class="input selec">
                                                                    <option value="1">Domestica</option>
                                                                    <option value="2">Industrial</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                </form>
                            </div>
                            <div id="Div_pmenu">
                                <center>
                                    <span style="">
                                        <input type="button" name="Btn_Guardar" id="Btn_Guardar" value="Guardar"
                                               class="boton" >
                                        <!--<input type="button" name="btnEliminar" id="btnEliminar" value="Eliminar"
                                               class="boton letrasI btnEliminar"  >-->
                                        <input type="button" name="Btn_Nuevo" id="Btn_Nuevo" value="Nuevo"
                                               class="boton">
                                    </span>
                                </center>
                            </div>
                        </div>
                        <img id="imgLoading" style="position:absolute;
                             width: 80px;height: 90px; margin-right: auto; margin-left:  -50px;
                             margin-top: -150px; z-index: 4; display:none" src="../../img/loading.gif">
                        </div>
                        </div>
                        </section>
                        <footer>
                        </footer>
                        </html>
